package com.wyw.learning.thread.immutable;

/**
 * 测试final能否被修改
 *
 * @author Mr Wu    yewen.wu.china@gmail.com
 * <p>
 * Update History:
 * Author        Time            Content
 */
public class TestFinal {
    public static void main(String[] args) {
//        Person person = new Person();//当有一个可变的对象存在时就不满足对象不可变的情况
//
////        person.age = 1; // Cannot assign a value to final variable 'age'
//        String name  = person.name;//可以被任何线程读取，但是不能被修改
        final Person person = new Person();
        person.bag = "book";
        System.out.println(person.bag);
    }
}
